package com.xiangxiao.rpan.file.consumer.callback;

import com.alibaba.fastjson.JSONObject;
import com.xiangxiao.rpan.file.constant.ResponseCode;
import com.xiangxiao.rpan.file.consumer.IConsumerStorageClient;
import com.xiangxiao.rpan.file.dto.FileQueryDto;
import com.xiangxiao.rpan.file.utils.ReturnUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @auther xiangxiao
 * @email 573768011@qq.com
 * @data 2023/12/26 17:38
 */
@Component
public class StorageClientCall implements IConsumerStorageClient {

  @Override
  public JSONObject getFiles(FileQueryDto fileQueryDto) {
    String error = "{\"error\":\"ConsumerStorageClient getFiles method has error -----rpan-storage\"}";
    return ReturnUtils.getHystrixReturn(String.valueOf(ResponseCode.QUERY_FILE_LIST_FAILED), "调用Storage服务异常，走熔断器", "调用Storage服务【getFiles】异常，走熔断器");
  }

  @Override
  public JSONObject bigFileUploadMulti(MultipartFile file, String fileMD5, Long fileSize,
                                       int totalChunks, int currChunks) {
    String error = "{\"error\":\"ConsumerStorageClient bigFileUploadMulti method has error -----rpan-storage\"}";
    return ReturnUtils.getHystrixReturn(String.valueOf(ResponseCode.UPLOAD_MULTI_FILE_FAILED), "调用Storage服务异常，走熔断器", "调用Storage服务【bigFileUploadMulti】异常，走熔断器");

  }
}
